package app.kernel.psgManager;

import java.lang.Comparable;
// This class stores references to all the physical spaces
// registered in a semantic cluster.
public class PhysicalSpace implements Comparable{
	
	public String myName; // Name of PSG -> May be changed to Signature
	public String myListeningPort; // Listening port of PSG
	public int numLinks; // Number of links.
	
	public PhysicalSpace(String name, String listeningPort){
		
		myName = name;
		myListeningPort = listeningPort;
		
	}
	
	public String getName(){
		
		return myName;
	}
	
	public int getPriority(){
		
		return numLinks;
		
	}
	
	public String getAddress(){
		
	   return myListeningPort;	
	}
	
	public int compareTo(Object anotherPS) throws ClassCastException {
		
	    if (!(anotherPS instanceof PhysicalSpace))
	      throw new ClassCastException("A Physical Space object expected.");
	    
	    int anotherPSpriority = ((PhysicalSpace) anotherPS).getPriority();  
	    return this.numLinks - anotherPSpriority;
	    
	}	
}
